package utils
{
 import flash.display.Graphics;
 
 import spark.components.Label;
 import spark.primitives.supportClasses.FilledElement;
 
 public class Sector extends FilledElement
 {
  private var graphics:Graphics;
 
  [Bindable]
  private var _r:Number;
  protected var rChanged:Boolean;
 
  [Bindable]
  private var _R:Number;
  protected var RChanged:Boolean;
 
  [Bindable]
  private var _angle:Number;
  [Bindable]
  private var _startA:Number;
  [Bindable]
  private var _color:uint;
  [Bindable]
  private var _alpha:Number;
 
  [Bindable]
  private var _label:String="";
  protected var labelChanged:Boolean;
  
  public function Sector()
  {
   //TODO: implement function
   super();
  }
 
  public function get label():String
  {
   return _label;
  }
 
  public function set label(value:String):void
  {
   _label = value;
  }
 
  public function get color():uint
  {
   return _color;
  }
 
  public function set color(value:uint):void
  {
   _color=value;
  }
 
  public function get startA():Number
  {
   return _startA;
  }
 
  public function set startA(value:Number):void
  {
   _startA=value;
  }
 
  public function get angle():Number
  {
   return _angle;
  }
 
  public function set angle(value:Number):void
  {
   _angle=value;
  }
 
  public function get R():Number
  {
   return _R;
  }
 
  public function set R(value:Number):void
  {
   if (value == _r)
   {
    return;
   }
   _R=value;
   rChanged=true;
   this.invalidateProperties();
  }
 
  public function get r():Number
  {
   return _r;
  }
 
  public function set r(value:Number):void
  {
   if (value == _r)
   {
    return;
   }
   _r=value;
   rChanged=true;
   this.invalidateProperties();
  }
 
  override protected function draw(g:Graphics):void
  {
   this.graphics=g;
   GraphicsUtil.drawSector(g, drawX + width / 2, drawY + height / 2, r, R, angle, startA, color, alpha);
  }
 
  override protected function commitProperties():void
  {
   super.commitProperties();
 
   /*if (rChanged && this.graphics)
   {
    rChanged=false;
    this.draw(this.graphics);
   }*/
   if (RChanged && this.graphics)
   {
    RChanged=false;
    this.draw(this.graphics);
   }
   /*if (labelChanged)
   {
    labelChanged=false;
    var label:Label=new Label();
    label.text=this.label;
   }*/
  }
 
 }
}